/*  1:   */ package org.intellij.images.thumbnail.actions;
/*  2:   */ 
/*  3:   */

import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.Presentation;
import com.intellij.openapi.fileEditor.FileEditorManager;
import com.intellij.openapi.vfs.VirtualFile;
import org.intellij.images.fileTypes.ImageFileTypeManager;
import org.intellij.images.thumbnail.ThumbnailView;
import org.intellij.images.thumbnail.actionSystem.ThumbnailViewActionUtil;

/*  4:   */
/*  5:   */
/*  6:   */
/*  7:   */
/*  8:   */
/*  9:   */
/* 10:   */
/* 11:   */ 
/* 12:   */ public final class EnterAction
/* 13:   */   extends AnAction
/* 14:   */ {
/* 15:   */   public void actionPerformed(AnActionEvent paramAnActionEvent)
/* 16:   */   {
/* 17:34 */     ThumbnailView localThumbnailView = ThumbnailViewActionUtil.getVisibleThumbnailView(paramAnActionEvent);
/* 18:35 */     if (localThumbnailView != null)
/* 19:   */     {
/* 20:36 */       VirtualFile[] arrayOfVirtualFile1 = localThumbnailView.getSelection();
/* 21:37 */       if ((arrayOfVirtualFile1.length == 1) && (arrayOfVirtualFile1[0].isDirectory()))
/* 22:   */       {
/* 23:38 */         localThumbnailView.setRoot(arrayOfVirtualFile1[0]);
/* 24:   */       }
/* 25:39 */       else if (arrayOfVirtualFile1.length > 0)
/* 26:   */       {
/* 27:40 */         FileEditorManager localFileEditorManager = FileEditorManager.getInstance(localThumbnailView.getProject());
/* 28:41 */         ImageFileTypeManager localImageFileTypeManager = ImageFileTypeManager.getInstance();
/* 29:42 */         for (VirtualFile localVirtualFile : arrayOfVirtualFile1) {
/* 30:43 */           if (localImageFileTypeManager.isImage(localVirtualFile)) {
/* 31:44 */             localFileEditorManager.openFile(localVirtualFile, false);
/* 32:   */           }
/* 33:   */         }
/* 34:   */       }
/* 35:   */     }
/* 36:   */   }
/* 37:   */   
/* 38:   */   public void update(AnActionEvent paramAnActionEvent)
/* 39:   */   {
/* 40:52 */     super.update(paramAnActionEvent);
/* 41:53 */     if (ThumbnailViewActionUtil.setEnabled(paramAnActionEvent))
/* 42:   */     {
/* 43:54 */       Presentation localPresentation = paramAnActionEvent.getPresentation();
/* 44:55 */       ThumbnailView localThumbnailView = ThumbnailViewActionUtil.getVisibleThumbnailView(paramAnActionEvent);
/* 45:56 */       VirtualFile[] arrayOfVirtualFile1 = localThumbnailView.getSelection();
/* 46:57 */       if (arrayOfVirtualFile1.length > 0)
/* 47:   */       {
/* 48:58 */         if ((arrayOfVirtualFile1.length == 1) && (arrayOfVirtualFile1[0].isDirectory()))
/* 49:   */         {
/* 50:59 */           localPresentation.setVisible(true);
/* 51:   */         }
/* 52:60 */         else if (arrayOfVirtualFile1.length > 0)
/* 53:   */         {
/* 54:61 */           int i = 0;
/* 55:62 */           ImageFileTypeManager localImageFileTypeManager = ImageFileTypeManager.getInstance();
/* 56:63 */           for (VirtualFile localVirtualFile : arrayOfVirtualFile1) {
/* 57:64 */             i |= (!localImageFileTypeManager.isImage(localVirtualFile) ? 1 : 0);
/* 58:   */           }
/* 59:66 */           localPresentation.setEnabled(i == 0);
/* 60:67 */           localPresentation.setVisible(false);
/* 61:   */         }
/* 62:   */         else
/* 63:   */         {
/* 64:69 */           localPresentation.setVisible(false);
/* 65:70 */           localPresentation.setEnabled(false);
/* 66:   */         }
/* 67:   */       }
/* 68:   */       else
/* 69:   */       {
/* 70:73 */         localPresentation.setVisible(false);
/* 71:74 */         localPresentation.setEnabled(false);
/* 72:   */       }
/* 73:   */     }
/* 74:   */   }
/* 75:   */ }



/* Location:           E:\idea\

 * Qualified Name:     org.intellij.images.thumbnail.actions.EnterAction

 * JD-Core Version:    0.7.0.1

 */